package com.play.map.service;

import com.play.common.enums.MapTypeEnums;
import com.play.map.repository.MapRepository;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.EnumMap;
import java.util.Map;

/**
 * @description:
 * @author: ChenYunChou
 * @time: 2021/10/17 2021
 */
@Service
public class MapFactory {

    private final EnumMap<MapTypeEnums, MapRepository> map;

    public MapFactory(Collection<MapRepository> mapRepositories) {
        this.map = new EnumMap<MapTypeEnums, MapRepository>(MapTypeEnums.class);
        for (MapRepository mapRepository : mapRepositories) {
            map.put(mapRepository.getType(), mapRepository);
        }
    }
}
